package com.aoxin.util.enumerate;

import com.aoxin.util.ErrorUtil;

/**
 * 预约状态
 * 
 * @author Melody
 * @date 2018年4月11日 上午10:03:06
 */
public enum OrderCourseStatus {
	SUCCESS(1, "成功"), FAIL(2, "失败"), WAIT(3, "排队中"), CANCEL(4, "已取消");

	private int id;

	private String value;

	private OrderCourseStatus(int id, String value) {
		this.id = id;
		this.value = value;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public static OrderCourseStatus fromId(int id) {
		switch (id) {
		case 1:
			return SUCCESS;
		case 2:
			return FAIL;
		case 3:
			return WAIT;
		case 4:
			return CANCEL;
		}
		throw new RuntimeException(String.format(ErrorUtil.ORDER_COURSE_STATUS, id));
	}
}
